/*
 * Copyright (c) 2010, Nikolaus Moll
 * All rights reserved.
 */
package net.miblounge.gradecalculator.gui.dialogs;

import net.miblounge.gradecalculator.core.AdaptedRegulations;
import net.miblounge.gradecalculator.core.descriptors.courses.Course;

import com.trolltech.qt.gui.QWidget;

public class ResultDialog extends AbstractResultDialog
{

    public ResultDialog(final QWidget parent, final AdaptedRegulations regulations, final Course course)
    {
        super(parent, regulations, course);
    }

    @Override
    protected boolean hasGradedPerformance()
    {
        return (!getCourse().getGradedPerformance().isEmpty());
    }

    @Override
    protected boolean hasUngradedPerformance()
    {
        return (!getCourse().getUngradedPerformance().isEmpty());
    }

    @Override
    protected boolean hasEstimatedGroup()
    {
        return (!getCourse().getGradedPerformance().isEmpty());
    }

    @Override
    protected String getCourseName()
    {
        return getCourse().getName();
    }

    @Override
    public void apply()
    {
        if (!getCourse().getGradedPerformance().isEmpty()) {
            getResult().setGrades(getGrades());
        }
        if (!getCourse().getUngradedPerformance().isEmpty()) {
            getResult().setUngradedPassed(getUngradedPassed());
        }

        super.apply();
    }

}
